import asyncio as asyncio
from collections.abc import Callable, Coroutine
from typing import Any
from typing_extensions import TypeAlias

from .langhelpers import memoized_property

_greenlet: TypeAlias = Any  # actually greenlet.greenlet

def is_exit_exception(e): ...

class _AsyncIoGreenlet(_greenlet):
    driver: Any
    gr_context: Any
    def __init__(self, fn, driver) -> None: ...

def await_only(awaitable: Coroutine[Any, Any, Any]) -> Any: ...
def await_fallback(awaitable: Coroutine[Any, Any, Any]) -> Any: ...
async def greenlet_spawn(fn: Callable[..., Any], *args, _require_await: bool = ..., **kwargs) -> Any: ...

class AsyncAdaptedLock:
    @memoized_property
    def mutex(self): ...
    def __enter__(self): ...
    def __exit__(self, *arg, **kw) -> None: ...

def get_event_loop(): ...
